package com.redrose.flutterdemo.ui.activitys;

import android.Manifest;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import com.alibaba.android.arouter.launcher.ARouter;
import com.redrose.flutterdemo.R;
import com.redrose.flutterdemo.databinding.ActivityLoginBinding;
import com.redrose.flutterdemo.utils.Utils;

/**
 * Desc:
 * @author: RedRose
 * Date: 2019/5/19 0019
 * Email: yinsxi@163.com
 */
public class LoginActivity extends BaseActivity<ActivityLoginBinding> {
    @Override
    public void initData() {
        setRightTitle(getString(R.string.register));
        setLeftTitle(getString(R.string.close));
        hideToolBar();
        mBinding.setLoginHandler(new LoginHandler());
        hideBack();
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public int setLayout() {
        initState();
        return R.layout.activity_login;
    }
    public class LoginHandler{
        String[] permissoons = new String[]{
                Manifest.permission.CAMERA,
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
                Manifest.permission.READ_EXTERNAL_STORAGE
        };
        public void login(){
            ARouter.getInstance()
                    .build("/activity/main")
                    .withString("name","秋不白")
                    .withInt("age",26)
                    .navigation();
        }
        public void test(){
            if (!hasPermission(permissoons[0])) {
                requestPeermission(permissoons, 0);
            }else {
                ARouter.getInstance()
                        .build("/activity/test")
                        .withString("name", "秋不白")
                        .withInt("age", 26)
                        .navigation();
            }
        }
        public void openImages(){
            ARouter.getInstance()
                    .build("/activity/images")
                    .navigation();
        }
    }
}
